#include <netinet/tcp.h>
#include "struct.h"
enum {
    TRUCT_ENDIAN_NOT_SET,
    STRUCT_ENDIAN_BIG,
    STRUCT_ENDIAN_LITTLE
    };

int get_endian(void)
{
    int i = 0x00000001;
    if (((char *)&i)[0]) {
        return STRUCT_ENDIAN_LITTLE;
    } else {
        return STRUCT_ENDIAN_BIG;
    }
}

struct {
    char t;
    uint32_t len;

}table;
extern int32_t struct_pack(uint8_t *buf, const char *fmt, ...);
extern int32_t struct_pack_into(int32_t offset,
                                uint8_t *buf, const char *fmt, ...);
extern int32_t struct_unpack(uint8_t *buf, const char *fmt, ...);
extern int32_t struct_unpack_from(int32_t offset,
                                  uint8_t *buf, const char *fmt, ...);
extern int32_t struct_calcsize(const char *fmt);


